#ifndef _PORTAL_H_
#define _PORTAL_H_

#include "wiisprite.h"
#include "Box2D.h"

using namespace wsp;

class Portal {

	public:
		Portal(Image* open_img, Image* closed_img,  Image* walledImg);
		~Portal();
		
		void SetLocation(b2Vec2* l){_Location.x = l->x; _Location.y = l->y;} 
		void SetLocation(float x, float y){_Location.x = x; _Location.y = y;} 
		
		void SetRotation(float r){_Rotation = r;}
		
		b2Vec2* GetLocation(){return &_Location;}
		
		float GetRotation(){return _Rotation;}
		
		void SetEnabled(bool e){_isSet = e;}
		
		void SetAngle(float a);
		
		void Clear(){_isSet = false;}
		
		bool IsSet(){return _isSet;}
		void SetInPortal(bool b){_portalReadyForEntry = b;}
		
		void Render(float dx, float dy);
		
		void SetWalled(bool b);
		
		//Returns percentage of object in portal,
		//   0 = not in portal
		//   1 = entirely in portal
		float IsInPortal(Sprite* s);
		
		bool IsWalled(){return _walled;}
		bool GetAngle(){return _angle;}
		
		void SetOpen(bool b){_open = b;}
		
	private:
		Image* _openPortalImg;
		Image* _closedPortalImg;
		Image* _walledImg;
	
		b2Vec2 _Location;
		float _Rotation;
		
		bool _portalReadyForEntry;	
		
		Sprite _sprite;
		
		bool _isSet;
		
		bool _walled;
		
		bool _open;
		
		float _angle;
};

#endif //_PORTAL_H_
